package com.zzz.demo.monitor.endpoint;

import org.springframework.boot.actuate.endpoint.annotation.Endpoint;
import org.springframework.boot.actuate.health.AbstractHealthIndicator;
import org.springframework.boot.actuate.health.Health;
import org.springframework.stereotype.Component;

/**
 * 通过继承 AbstractHealthIndicator 来实现值,状态的监控
 */
@Component
@Endpoint(id = "var")
public class VarMonitor extends AbstractHealthIndicator {

    public int var = 1000;

    @Override
    protected void doHealthCheck(Health.Builder builder) throws Exception {
        builder.withDetail("var的值是: " , var);
    }
}
